package net.lab1024.sa.admin.module.business.amount.controller;

import net.lab1024.sa.admin.module.business.amount.domain.form.AmountAddForm;
import net.lab1024.sa.admin.module.business.amount.domain.form.AmountQueryForm;
import net.lab1024.sa.admin.module.business.amount.domain.form.AmountUpdateForm;
import net.lab1024.sa.admin.module.business.amount.domain.vo.AmountVO;
import net.lab1024.sa.admin.module.business.amount.service.AmountService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 钱包表 Controller
 *
 * @Author syf
 * @Date 2025-05-29 15:15:31
 * @Copyright 畅想科技
 */

@RestController
@Tag(name = "")
public class AmountController {

    @Resource
    private AmountService amountService;

    @Operation(summary = "分页查询 @author syf")
    @PostMapping("/amount/queryPage")
    public ResponseDTO<PageResult<AmountVO>> queryPage(@RequestBody @Valid AmountQueryForm queryForm) {
        return ResponseDTO.ok(amountService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author syf")
    @PostMapping("/amount/add")
    public ResponseDTO<String> add(@RequestBody @Valid AmountAddForm addForm) {
        return amountService.add(addForm);
    }

    @Operation(summary = "更新 @author syf")
    @PostMapping("/amount/update")
    public ResponseDTO<String> update(@RequestBody @Valid AmountUpdateForm updateForm) {
        return amountService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author syf")
    @PostMapping("/amount/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return amountService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/amount/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return amountService.delete(id);
    }
}
